Skip to content

chore: add electron-log for persistent file logging#28

Merged
dakl merged 1 commit intomainfrom
all-agents-stop
Apr 2, 2026
Merged

chore: add electron-log for persistent file logging#28
dakl merged 1 commit intomainfrom
all-agents-stop

Conversation

@dakl
Copy link
Copy Markdown
Owner

@dakl dakl commented Apr 1, 2026

Summary

Add persistent file logging via electron-log to diagnose why sessions stop mid-operation without warning.

What Changed

  • Install electron-log v5.4.3 as a runtime dependency
  • Create src/main/logger.ts to initialize electron-log at startup
    • Logs written to ~/Library/Logs/Codez/main.log
    • Captures all console.log/console.error output automatically
    • Forwards renderer process console output via IPC
  • Update src/main/index.ts to import logger as the first module

Why

Previously, when sessions mysteriously stopped mid-operation, there were no logs to diagnose the cause. The main process would crash or restart, resetting all sessions to idle, but we had no way to see what went wrong.

With electron-log, every log message (including crash context from node-pty, better-sqlite3, etc.) is now written to a persistent file. The next time this issue occurs, ~/Library/Logs/Codez/main.log will contain a complete diagnostic history.

Testing

  • ✅ All 227 unit/integration tests pass
  • ✅ Build succeeds (TypeScript + Vite)
  • ✅ Lint clean (no Biome issues)
  • ✅ Logger integrates cleanly — zero changes to existing files except the import

The logger is transparent to existing code — all existing console.log/console.error calls are automatically captured without any modifications to those files.

Next Steps

Monitor ~/Library/Logs/Codez/main.log on the next occurrence of sessions stopping mid-operation.

- Install electron-log v5.4.3 dependency
- Create logger.ts module that initializes electron-log
- Configure to write logs to ~/Library/Logs/Codez/main.log
- Override console methods to capture all console.log/error output automatically
- Enable spyRendererConsole to also capture renderer process logs
- Import logger at app startup so all process startup logs are captured

This addresses the issue where sessions stop mid-operation without any
diagnostic logs. The next time this occurs, ~/Library/Logs/Codez/main.log
will contain a complete history of what happened.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@dakl dakl merged commit df7c976 into main Apr 2, 2026
3 checks passed
@dakl dakl deleted the all-agents-stop branch April 2, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant